<!--
 * @Description:
 * @Author: yangyihui
 * @Date: 2021-03-10 16:56:45
 * @LastEditors: yangyihui
 * @LastEditTime: 2021-10-09 18:14:18
-->

<template>
  <div>
    <div class="c-flex-row c-aligni-center" @click="pickItem(items)">
      <div class="icon-radio" v-show="!isChecked"></div>
      <div class="icon-radio" v-show="isChecked">
        <div class="icon-radio-checked c-bg-xlgreen"></div>
      </div>
      <div class="c-ph20 c-fs22 c-fc-xblack">
        {{ (items.dynamicName || items.realName || items.userName) | hiddenLiveUserName(isHideUserName) }}
        <!-- {{items.realName?items.realName:items.userName}} -->
      </div>
      <template v-if="items.role!=1">
        <div v-if="items.role==2" class="c-flex-shrink0" :class="items.subRole==1 ? 'role-guest':'role-teacher'">{{items.tag}}</div>
        <div v-if="items.role==4" class="role-admin c-flex-shrink0">管</div>
        <div v-if="items.role==6" class="c-flex-shrink0"><span  :class="items.subRole==1 ? 'role-guest':'role-teacher'">{{items.tag}}</span></div>
      </template>
    </div>
  </div>
</template>

<script>
export default {
  components: {
  },
  props: {
    items: {
      type: Array,
      default: () => {
        return []
      },
    },
  },
  watch: {

  },
  data() {
    return {
      isChecked: false
    };
  },
  methods: {
    pickItem() {
      this.isChecked = !this.isChecked
      if (this.isChecked) {
        this.$set(this.items, "isChecked", 1);
      } else {
        this.$set(this.items, "isChecked", -1);
      }
    },
  },
  deactivated() {
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.icon-radio {
  width: 0.55rem;
  height: 0.55rem;
  border: 1px solid #ccc;
  border-radius: 50%;
  padding: 0.1rem;;
  font-size: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.icon-radio-checked {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  font-size: 0;
}
.role-teacher,
.role-admin,
.role-guest
{
  padding: 0 0.15rem;
  height: .6rem;
  line-height:.6rem;
  overflow: hidden;
  display: inline-block;
  border-radius:.15rem;
  color: #fff;
  font-size:.4rem;
}

.role-teacher,.role-guest{
  background: linear-gradient(270deg,#3a86fd, #43befe);
}
.role-admin {
  background: linear-gradient(316deg,#f45300, #ff9f5a 88%);
}
</style>
